from framework.BaseService import BaseService


class MemberActivityRecordService(BaseService):
    def getRecords(self, mid, atype, pageNo, pageSize):
        if (atype==None or atype==''):
            sql="SELECT a.* " \
                    "FROM `bis_member_activity_record` a "\
                    "LEFT OUTER JOIN `bis_activity` b ON a.`active_id`=b.`id` " \
                    "WHERE a.`member_id`='"+mid+"'"

        else:
            sql="SELECT a.* "\
                    "FROM `bis_member_activity_record` a "\
                    "LEFT OUTER JOIN `bis_activity` b ON a.`active_id`=b.`id` " \
                    "WHERE a.`member_id`='"+mid+"' AND b.`atype`='"+atype+"'"

        return self.mySql.selectPage(sql,pageNo,pageSize);
